﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace ScarEngine
{
    /// <summary>
    /// This component is to allow you to assign a velocity onto an object
    /// and then have the update function move the object as so. Since this ties
    /// in with physics and gravity, it is a prereq of the physics component.
    /// </summary>
    public class VelocityComponent : Component
    {
        /// <summary>
        /// The velocity of an object
        /// Pixels Per Second
        /// Velocity will be set to 0 if negative
        /// And Angular velocity will be reversed
        /// </summary>
        public float Velocity;

        /// <summary>
        /// The angle in which the object will removed
        /// IN RADIANS
        /// 0 = up
        /// -pi = down
        /// pi = down
        /// </summary>
        public float Angle; //to do add properties and angle wrapper

        public VelocityComponent()
            : base()
        {
            MasterManager.PhysicsManager.RegisterVelocityComponent(this);

            Velocity = 0;
            Angle = 0;
        }



        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }



        #region Core

        public override void Prerequisites()
        {
            if (Object.HasComponent<PositionalComponent>() == false)
            {
                Object.Add<PositionalComponent>("Position");
            }
            base.Prerequisites();
        }

        #endregion

    }
}